/*
----------------------------------------------------------------------------
%include "/projects/data_commons/lbd_code/lbd_m_merge_ch_ind_sect.sas" /source2;
%merge_ch_ind_sect(ds_in= , ds_out= );
----------------------------------------------------------------------------
*/


%macro merge_ch_ind_sect(ds_in= , ds_out=);

proc import out=ind_sect datafile="/projects/data_commons/cw/cw_ind_sect_fk_imp.csv";
run;

data ind_sect;
  set ind_sect;
  ch_ind=round(ch_ind, 0.1);
run;

proc sort data=ind_sect;
  by ch_ind;
run;

data &ds_out.;
  set &ds_in.;
  ch_ind=round(ch_ind, 0.1);
run;

proc sort data=&ds_out.;
  by ch_ind;
run;

data &ds_out.;
  merge &ds_out.(in=in_main) ind_sect(in=in_sect);
  by ch_ind;
  if in_main=1;
run;

%mend;

/* End of SAS file */
